//
//  ViewController.m
//  UIWebView
//
//  Created by clz on 2019/8/25.
//  Copyright © 2019年 clz. All rights reserved.
//

#import "ViewController.h"
#import <WebKit/WebKit.h>

@interface ViewController ()<WKNavigationDelegate>

@property(nonatomic,strong)WKWebView *webview;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //WKWebView
    
    self.webview = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    self.webview.backgroundColor = [UIColor redColor];
    self.webview.scrollView.backgroundColor = [UIColor yellowColor];
    self.webview.navigationDelegate = self;
    [self.view addSubview:self.webview];
    
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://www.baidu.com/"]];
    
    [self.webview loadRequest:request];
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{
    NSLog(@"加载完成");
}

- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error{
    NSLog(@"加载失败");
}


@end
